home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 98 / Skunkware 98.iso / src / interp / perl5.005.tar.gz / perl5.005.tar / perl5.005 / Porting / makerel < prev    next >
Text File  |  1998-07-12  |  4KB  |  118 lines

  1. #!/bin/env perl -w
  2.  
  3. # A first attempt at some automated support for making a perl release.
  4. # Very basic but functional - if you're on a unix system.
  5. #
  6. # No matter how automated this gets, you'll always need to read
  7. # and re-read pumpkin.pod checking for things to be done at various
  8. # stages of the process.
  9. #
  10. # Tim Bunce, June 1997
  11.  
  12. use ExtUtils::Manifest qw(fullcheck);
  13.  
  14. $|=1;
  15. $relroot = "..";    # XXX make an option
  16.  
  17. die "Must be in root of the perl source tree.\n"
  18.     unless -f "./MANIFEST" and -f "patchlevel.h";
  19.  
  20. open PATCHLEVEL,"<patchlevel.h" or die;
  21. my @patchlevel_h = <PATCHLEVEL>;
  22. close PATCHLEVEL;
  23. my $patchlevel_h = join "", grep { /^#define/ } @patchlevel_h;
  24. print $patchlevel_h;
  25. $patchlevel = $1 if $patchlevel_h =~ /PATCHLEVEL\s+(\d+)/;
  26. $subversion = $1 if $patchlevel_h =~ /SUBVERSION\s+(\d+)/;
  27. die "Unable to parse patchlevel.h" unless $subversion >= 0;
  28. $vers = sprintf("5.%03d", $patchlevel);
  29. $vms_vers = sprintf("5_%03d", $patchlevel);
  30. if ($subversion) {
  31.     $vers.= sprintf( "_%02d", $subversion);
  32.     $vms_vers.= sprintf( "%02d", $subversion);
  33. } else {
  34.     $vms_vers.= "  ";
  35. }
  36.  
  37. # fetch list of local patches
  38. my (@local_patches, @lpatch_tags, $lpatch_tags);
  39. @local_patches = grep { /^static.*local_patches/../^};/ } @patchlevel_h;
  40. @local_patches = grep { !/^\s*,?NULL/  } @local_patches;
  41. @lpatch_tags   = map  {  /^\s*,"(\w+)/ } @local_patches;
  42. $lpatch_tags   = join "-", @lpatch_tags;
  43.  
  44. $perl = "perl$vers";
  45. $reldir = "$perl";
  46. $reldir .= "-$lpatch_tags" if $lpatch_tags;
  47.  
  48. print "\nMaking a release for $perl in $relroot/$reldir\n\n";
  49.  
  50. print "Cross-checking the MANIFEST...\n";
  51. ($missfile, $missentry) = fullcheck();
  52. warn "Can't make a release with MANIFEST files missing.\n" if @$missfile;
  53. warn "Can't make a release with files not listed in MANIFEST.\n" if @$missentry;
  54. if ("@$missentry" =~ m/\.orig\b/) {
  55.     # Handy listing of find command and .orig files from patching work.
  56.     # I tend to run 'xargs rm' and copy and paste the file list.
  57.     my $cmd = "find . -name '*.orig' -print";
  58.     print "$cmd\n";
  59.     system($cmd);
  60. }
  61. die "Aborted.\n" if @$missentry or @$missfile;
  62. print "\n";
  63.  
  64. # VMS no longer has hardcoded version numbers descrip.mms
  65. #print "Updating VMS version specific files with $vms_vers...\n";
  66. #system("perl -pi -e 's/^\QPERL_VERSION = \E\d\_\d+(\s*\#)/PERL_VERSION = $vms_vers$1/' vms/descrip.mms");
  67.  
  68.  
  69. print "Setting file permissions...\n";
  70. system("find . -type f -print     | xargs chmod -w");
  71. system("find . -type d -print     | xargs chmod g-s");
  72. system("find t -name '*.t' -print | xargs chmod +x");
  73. @exe = qw(
  74.     Configure
  75.     configpm
  76.     embed.pl
  77.     installperl
  78.     installman
  79.     keywords.pl
  80.     myconfig
  81.     opcode.pl
  82.     perly.fixer
  83.     t/TEST
  84.     t/*/*.t
  85.     *.SH
  86.     vms/ext/Stdio/test.pl
  87.     vms/ext/filespec.t
  88.     x2p/*.SH
  89.     Porting/patchls
  90.     Porting/makerel
  91. );
  92. system("chmod +x @exe");
  93. print "\n";
  94.  
  95.  
  96. print "Creating $relroot/$reldir release directory...\n";
  97. die "$relroot/$reldir release directory already exists\n"   if -e "$relroot/$reldir";
  98. die "$relroot/$reldir.tar.gz release file already exists\n" if -e "$relroot/$reldir.tar.gz";
  99. mkdir("$relroot/$reldir", 0755) or die "mkdir $relroot/$reldir: $!\n";
  100. print "\n";
  101.  
  102.  
  103. print "Copying files to release directory...\n";
  104. # ExtUtils::Manifest maniread does not preserve the order
  105. $cmd = "awk '{print \$1}' MANIFEST | cpio -pdm $relroot/$reldir";
  106. system($cmd) == 0 or die "$cmd failed";
  107. print "\n";
  108.  
  109. chdir $relroot or die $!;
  110.  
  111. print "Creating and compressing the tar file...\n";
  112. my $src = (-e $perl) ? $perl : 'perl'; # 'perl' in maint branch
  113. $cmd = "tar cf - $reldir | gzip --best > $reldir.tar.gz";
  114. system($cmd) == 0 or die "$cmd failed";
  115. print "\n";
  116.  
  117. system("ls -ld $perl*");
  118.